package com.cavy.platform.server;

import lombok.Data;

import java.io.File;

@Data
public class ConfigMapSetting {
    private String fileDir;
    private String dataDir;

    public File getFileDir() {
        File file = new File(fileDir);
        if (!file.exists()) {
            boolean mkdirs = file.mkdirs();
            if (!mkdirs) {
                throw new RuntimeException("创建文件夹：" + file.getPath() + "失败");
            }
        }
        return file;
    }

    public File getDataDir() {
        File file = new File(dataDir);
        if (!file.exists()) {
            boolean mkdirs = file.mkdirs();
            if (!mkdirs) {
                throw new RuntimeException("创建文件夹：" + file.getPath() + "失败");
            }
        }
        return file;
    }
}
